<?php $this->load->view('common/cms-head'); ?>
<article id="content">
    <div class="pgwrapper">
    <div class="w960 bg1 p15 bx_shw">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
	style="border: 10px solid #e5e5e5; margin-bottom: 10px;">
	<tr>
		<td width="20%" style="border-right: 2px solid #e5e5e5;" valign="top">
		<?php $this->load->view('enterprises/leftnavCMS'); ?>
		</td>
		<td width="80%" valign="top" style="padding:5px;"><form enctype="multipart/form-data"
				action="" method="POST" name="myForm" id="myForm">
				<table width="100%" border="0" cellpadding="5" cellspacing="0"
					style="padding: 0px 30px;">
					<input type="hidden" value="<?php echo $store_id;?>" id="store_id" name="store_id">
					<input type="hidden" value="<?php echo $storeDetailsArray[0]['store_image'];?>" id="store_old_img" name="store_old_img">
					<tr>
						<td class="txt-blck">Select Category:</td>
						 <td><select id="store_category_tbl_id[]" multiple="multiple" style="width: 200px;height:100px;" name="store_category_tbl_id[]" class="setBgInput">
			                	<?php foreach ($allCategoriesArray as $temp){ ?>
								<option value="<?php echo $temp['category_id']; ?>" <?php if(in_array($temp['category_id'], $storeCategoriesArray)){ echo "selected"; }?>>
								<?php echo $temp['category_name']; ?>
								</option>
								<?php } ?>		                	
			            	</select></td>
						</tr>
						<tr>
						<td class="txt-blck">Relevant Category:</td>
						 <td><select id="relevant_category_id" style="width: 200px;padding-top:5px;" name="relevant_category_id"  class="setBgInput">
						 		<option value="0">Select</option>
			                	<?php foreach ($allCategoriesArray as $temp){ ?>
								<option value="<?php echo $temp['category_id']; ?>" <?php if($storeDetailsArray[0]['store_cat_id']==$temp['category_id']){ echo "selected"; }?>>
								<?php echo $temp['category_name']; ?>
								</option>
								<?php } ?>		                	
			            	</select></td>
						</tr>
					<tr>
						<td class="txt-blck" width="30%">Store Name:</td>
						<td width="70%"><input type="text" onblur="makeURLStore(this)"
							value="<?php echo $storeDetailsArray[0]['store_name'];?>" style="width: 400px"
							name="store_name" id="store_name" class="setBgInput"
							  />
						</td>
					</tr>
					<tr>
						<td class="txt-blck">Store Status:</td>
						<td><select id="store_status" name="store_status" style="width:90px;padding-top:5px;" class="setBgInput">
								<option value="Yes"
								<?php if ($storeDetailsArray[0]['store_status']=="Yes"){echo "selected"; }?>>Yes</option>
								<option value="No"
								<?php if ($storeDetailsArray[0]['store_status']=="No"){echo "selected"; }?>>No</option>
						</select></td>
					</tr>
					<tr>
							<td class="txt-blck">Store Type:</td>
							<td><select id="store_type" name="store_type" style="width:90px;padding-top:5px;" class="setBgInput">
									<option value="Promo"
									<?php if ($storeDetailsArray[0]['store_type']=="Promo"){echo "selected"; }?>>Promo</option>
									<option value="Money"
									<?php if ($storeDetailsArray[0]['store_type']=="Money"){echo "selected"; }?>>Money</option>
							</select></td>
						</tr>
					<tr>
		<td class="txt-blck" width="30%">Store Image:</td>
		<td>
		<img src="<?php //echo VIEWSTOREIMG;?><?php if(isset($storeDetailsArray[0]['store_image'])){ echo $storeDetailsArray[0]['store_image']; } ?>">
		<input type="file" value="<?php if(isset($storeDetailsArray[0]['store_image'])){ echo $storeDetailsArray[0]['store_image']; } ?>" id="store_image" name="store_image" class="setBgInput" /></td>
	</tr>
				<tr>
						<td class="txt-blck" width="30%">Store Url:</td>
						<td width="70%"><input type="text"
							value="<?php echo $storeDetailsArray[0]['store_url'];?>" style="width: 400px"
							name="store_url" id="store_url" class="setBgInput"
							  />
						</td>
					</tr>
					<tr>
						<td valign="top" class="txt-blck">Store Description:</td>
						<td width="70%"><textarea style="width: 450px; height: 300px;" class="setBgInput"
								id="store_description" name="store_description" class="setBgInput">
								<?php echo $storeDetailsArray[0]['store_description'];?>
								</textarea></td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Store Affilate Url:</td>
						<td width="70%"><input type="text"
							value="<?php echo $storeDetailsArray[0]['store_affilateurl'];?>" style="width: 400px"
							name="store_affilateurl" id="store_affilateurl" class="setBgInput"
							  />
						</td>
					</tr>
					
					<!-- <tr>
						<td class="txt-blck" width="30%">Store Redirect Url:</td>
						<td width="70%"><input type="text"
							value="<?php //echo $storeDetailsArray[0]['store_redirecturl'];?>" style="width: 400px"
							name="store_redirecturl" id="store_redirecturl" class="setBgInput"
							  />
						</td>
					</tr> -->
					
						<tr>
							<td class="txt-blck">Store Redirect:</td>
							<td><select id="store_redirecturl" name="store_redirecturl" style="width:100px;padding-top:5px;" class="setBgInput">
									<option value="0">Select</option>
									<option value="trootrac"
									<?php if ($storeDetailsArray[0]['store_redirecturl']=="trootrac"){echo "selected"; }?>>Trootrac</option>
									<option value="tyroo"
									<?php if ($storeDetailsArray[0]['store_redirecturl']=="tyroo"){echo "selected"; }?>>Tyroo</option>
									<option value="omg"
									<?php if ($storeDetailsArray[0]['store_redirecturl']=="omg"){echo "selected"; }?>>OMG</option>
							</select></td>
						</tr>
					
					<tr>
						<td class="txt-blck" width="30%">Store UTM Source:</td>
						<td width="70%"><input type="text"
							value="<?php echo $storeDetailsArray[0]['store_utmsource'];?>" style="width: 400px"
							name="store_utmsource" id="store_utmsource" class="setBgInput"
							  />
						</td>
					</tr>
					
					<tr>
						<td class="txt-blck" width="30%">Metatitle:</td>
						<td width="70%"><input type="text"
							value="<?php echo $storeDetailsArray[0]['metatitle'];?>" style="width: 400px"
							name="metatitle" id="metatitle" class="setBgInput"
							  />
						</td>
					</tr>
					<tr>
						<td class="txt-blck" width="30%">Meta Keyword:</td>
						<td width="70%"><input type="text"
							value="<?php echo $storeDetailsArray[0]['metakeyword'];?>" style="width: 400px"
							name="metakeyword" id="metakeyword" class="setBgInput"
							  />
						</td>
					</tr>
					<tr>
						<td valign="top" class="txt-blck">Meta Description:</td>
						<td><input type="text"
							value="<?php echo $storeDetailsArray[0]['metadescription'];?>" style="width: 400px"
							name="metadescription" id="metadescription" class="setBgInput"
							  /></td>
					</tr>
					<tr>
							<td class="txt-blck" width="30%">Store Tags:</td>
							<td width="70%"><input type="text" value="<?php echo implode(", ", $tagCloud);?>" name="store_tags"
								id="store_tags" class="setBgInput" style="width: 400px;" />
								<br /><span style="font-size:12px;">enter tags like yatra coupons, yatra.com, jabong discounts ..</span>
							</td>
						</tr>
					<?php if(isset($sessionUserData) && $sessionUserData['user_id']=='1'){?>
					<tr>
						<td><input type="button" name="code_verify" value="Verify" onclick="submitVerify();" class="btn_bg" /></td>
						<td><input type="button" name="code_reject" value="Reject" onclick="submitReject();" class="btn_bg" /></td>
					</tr>
					<?php }else{?>
					<tr>
						<td></td>
						<td><input type="button" name="code_continue" value="Continue" onclick="validateForm();submitStore();" class="btn_bg" /></td>
					</tr>
					<?php }?>
				</table>
			</form>
		</td>
	</tr>
</table>
</div>
</div>
</article>
<?php $this->load->view('common/cms-footer'); ?>
<script>

function validateForm(){
	var x = document.getElementById('store_name').value;
	if(x==""){
	alert("Store Name must be filled out.");
	return false;
	}
	var y = document.getElementById('store_affilateurl').value;
	if(y==""){
	alert("Store Affilate Url must be filled out.");
	return false;
	}
}

function submitStore() {
	document.forms.myForm.action = "/updateStore";
	document.forms.myForm.submit()
}

function submitReject() {
	document.forms.myForm.action = "/rejectStore";
	document.forms.myForm.submit()
}

function submitVerify() {
	document.forms.myForm.action = "/verifyStore";
	document.forms.myForm.submit()
}
</script>
